<?php
namespace App\Http\Controllers\blog\front\contab;

use DB;
use App\Http\Controllers\blog\LogController;
use App\Model\front\ArticalModel;
use Symfony\Component\HttpFoundation\Request;
use Illuminate\Support\Facades\Redis;
use Cache;

class BlogController extends LogController{

    public function __construct()
    {
        $this->Artical = new ArticalModel();
    }

    public function index(Request $request)
    {
       /* $key = Redis::get('php');
        Redis::set('name','helloword');
        //Redis::del('name');
        session(['name.lei'=>NULL]);
        session()->put('beijing.haidian','shanghai');
        //if(session()->exists('name')) dd(session()->all());
        Cache::put('profession','zhiye');
        Cache::put('name','gelei',1);
        Cache::forever('time','beijing');
        dd(Redis::get('name'));*/
        

        $ip = $request->getClientIp();
        $location = getLocation($ip);
        $list = $this->Artical->getArtList(['status'=>1]);
        $res = $list->toArray()['data'];
        return view('blog/front/contab/index')->with(compact('list','res','location'));
    }

    public function about(Request $request)
    {
        $ip = $request->getClientIp();
        $location = getLocation($ip);
        $list = $this->Artical->getArtList(['status'=>1]);
        $res = $list->toArray()['data'];
        return view('blog/front/contab/index')->with(compact('list','res','location'));
    }

    public function message(Request $request)
    {
        $ip = $request->getClientIp();
        $location = getLocation($ip);
        $list = $this->Artical->getArtList(['status'=>1]);
        $res = $list->toArray()['data'];
        return view('blog/front/contab/index')->with(compact('list','res','location'));
    }

    public function study(Request $request)
    {
        $ip = $request->getClientIp();
        $location = getLocation($ip);
        $list = $this->Artical->getArtList(['status'=>1]);
        $res = $list->toArray()['data'];
        return view('blog/front/contab/index')->with(compact('list','res','location'));
    }
}